// import proFetch from "../../../../public/functions/project-fetch";
import {hrAjax as ajax} from 'src/hrpub/common/utils/utils';

import {promptBox, toast} from 'nc-lightapp-front';
import handlePK from "./handlePK";

export default function deleteDisputedData(callback) {
    let {json} = this.props;
    if (!json){
        json = this.state.json;
    }
    const checkedData = this.props.editTable.getClickRowIndex('disputedlist') || [];
    let pk_workdispute = handlePK.get();
    if (!pk_workdispute) {
        toast({color: "warning", content: json['cm6011-000039']}); /* 国际化处理： 请选择要删除的条目!*/
        return;
    }
    promptBox({
        color: 'warning',
        title: json['cm6011-000041'], /* 国际化处理： 确认删除*/
        content: json['cm6011-000042'], /* 国际化处理： 您确定要删除选择数据吗？*/
        beSureBtnName: json['cm6011-000057']/*国际化处理：是*/,
        cancelBtnName: json['cm6011-000058']/*国际化处理：否*/,
        beSureBtnClick: () => {
            return ajax({
                url: '/nccloud/hrcm/disputed/DisputedDeleteAction.do',
                body: {
                    billid: pk_workdispute
                },
            }).then((res) => {
                if (res.success) {
                    toast({color: "success", content:json['cm6011-000004']});/* 国际化处理： 删除成功*/
                    callback && callback();
                }
            });
        }
    });
}
